{include file='public/meta'}
<title>服务列表</title>
</head>
<body>
{include file='public/header'}
{include file='public/menu'}
<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span>
		{$controller}
		<span class="c-gray en">&gt;</span>
		{$action}
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="Hui-article">
		<article class="cl pd-20">
			<div class="text-c">
				<form action="{:url('admin/service/service_list')}" method="post">
				<span class="select-box inline">
				<select name="cond" class="select">
					<option value="all">全部分类</option>
					<option value="statu">状态</option>
					<option value="comment">评价</option>
				</select>
				</span>
				<input type="text" name="key" id="" placeholder=" 关键字" style="width:250px" class="input-text">
				<button name="" id="" class="btn btn-success radius" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
				</form>
			</div>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="r">共有数据：<strong>{$data|count}</strong> 条</span>
			</div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							<th>ID</th>
							<th>服务类型</th>
							<th>房屋信息</th>
							<th>会员</th>
							<th>服务人员</th>
							<th>预约时间</th>
							<th>订单时间</th>
							<th>订单状态</th>
							<th>操作</th>
							<th>评价</th>
							<th>评价显示</th>
						</tr>
					</thead>
					<tbody>
						{volist name="data" id="vo"}
						<tr class="text-c va-m">
							<td>{$vo.id}</td>
							<td>{$vo.sname}</td>
							<td>{$vo.addr}</td>
							<td>{$vo.vname}</td>
							<td>{if condition="$vo.mid>0"}<a class="m_info" href="javascript:;"><span style="display:none;">{$vo.mid}</span>{$vo.uname}</a>{else}暂无{/if}</td>
							<td>{$vo.starttime}</td>
							<td>{$vo.requesttime}</td>
							{if condition="$vo.sname=='贴心管家'"}
							<td><span class="label label-warning radius">已结束</td>
								<td class="td-manage">
								<span class="label label-primary radius">订单完成</span>
							</td>
							{elseif condition="$vo.statu=='待接单'"}
							<td><span class="label label-info radius">{$vo.statu}</span></td>
							<td class="td-manage">
								<span class="label label-primary radius"><a class="catch" style="text-decoration:none" href="javascript:;">接单</a>
									<input type="hidden" value="{$vo.id}" name="">
								</span>
							</td>
							{elseif condition="$vo.statu=='待评价'"}
							<td><span class="label label-success radius">{$vo.statu}</td>
								<td class="td-manage">
								<span class="label label-primary radius">已服务</span>
							</td>
							{elseif condition="$vo.statu=='订单取消'"}
							<td><span class="label label-default radius">{$vo.statu}</td>
								<td class="td-manage">
								<span class="label label-primary radius">已取消</span>
							</td>
							{else}
							<td class="td-status"><span class="label label-warning radius">{$vo.statu}</span></td>
							<td class="td-manage">
								<span class="label label-primary radius">订单完成</span>
								{if condition="$vo.reply==''"}
								<span class="label label-default radius"><a class="reply" style="text-decoration:none" href="javascript:;">回评</a>
									<input type="hidden" value="{$vo.id}" name="">
								</span>
								{/if}
							</td>
							{/if}
							<td>{$vo.comment}</td>
							<td><a class="label label-danger radius look" href="javascript:;">{$vo.type}</a><input type="hidden" value="{$vo.id}" name=""></td>
						</tr>
						{/volist}
					</tbody>
				</table>
			</div>
		</article>
	</div>
</section>

{include file='public/footer'}
<!--请在下方写此页面业务相关的脚本-->
{load href='/static/lib/My97DatePicker/4.8/WdatePicker.js'}
{load href='/static/lib/datatables/1.10.0/jquery.dataTables.min.js'}
{load href='/static/lib/laypage/1.2/laypage.js'}
{js href="_js_/layer/layer.js"}

<script type="text/javascript">
	//接单
	$('.catch').click(function(){
		var data = 'id='+$(this).next().val();
		$.post('{:url('admin/service/catch')}',data,function(res){
			if(res.msg == '接单成功'){
				layer.msg(res.msg,{icon:1,time:1000},function(){location.reload();})
			}else{
				layer.msg(res.msg,{icon:1,time:1000})
			}
			
		});
	});

	//回评
	$('.reply').click(function(){
		var id = $(this).next().val();
		layer.prompt({title:'评论'},function(value,index){
			var data = 'id='+id+'&reply='+value;
			// alert(data);
			$.post('{:url('admin/service/reply')}',data,function(res){
				if(res.msg == '回评成功'){
					layer.msg(res.msg,{icon:1,time:1000},function(){location.reload();})
				}else{
					layer.msg(res.msg,{icon:1,time:1000})
				}
				
			});
		});
	});

	//评价显示
	$('.look').click(function(){
		var data = 'id='+$(this).next().val();
		$.post('{:url('admin/service/look')}',data,function(res){
			layer.msg(res.msg,{icon:1,time:1000},function(){location.reload();})
		});
	});

	//点击头像查看简介
	$('.m_info').click(function(){
		var id = $(this).children('span').text();
		layer_show('个人简信','{:url('admin/member/m_info')}'+'?uid='+id,'350','240');
	});

	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
		]
	});
</script>
</body>
</html>	